package com.zh.note.huawei.onehundred.座位调整;

/**
 * https://dream.blog.csdn.net/article/details/130906967
 */
public class Main {
    public static void main(String[] args) {
        // Scanner scanner = new Scanner(System.in);
        // String s = scanner.nextLine();
        String s = "0,0,0,0,0";
        String[] desks = s.split(",");
        int count = 0;
        int[] nums = new int[desks.length + 2];
        //构造一个新数组，在首尾都增加一个0，然后找有没有三个连续的0
        nums[0] = 0;
        nums[nums.length - 1] = 0;

        for (int i = 1; i <= desks.length; i++) {
            nums[i] = Integer.parseInt(desks[i - 1]);
        }

        for (int i = 1; i <= desks.length; i++) {
            if (nums[i] == 0 && nums[i - 1] == 0 && nums[i + 1] == 0) {
                nums[i] = 1;
                count++;
            }
        }
        System.out.println(count);
    }
}


